package com.threeti.mecool.core.domain.model.acl;

import com.threeti.mecool.core.domain.model.plan.pojo.Job;

import javax.persistence.*;

@Entity
@Table(name = "DM_PERMISSIONROLE_ACHIEVEMENT",
    uniqueConstraints = @UniqueConstraint(columnNames = {"permission_role", "job"}))
public class PermissionRoleAchievement {
    private Long id;
    private Integer version;
    private int targetCount;
    private PermissionRole permissionRole;
    private Job job;

    //<editor-fold desc="get/set">
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    public Long getId() {
        return id;
    }

    @Version
    public Integer getVersion() {
        return version;
    }

    public int getTargetCount() {
        return targetCount;
    }

    @ManyToOne(optional = false)
    public PermissionRole getPermissionRole() {
        return permissionRole;
    }

    @ManyToOne(optional = false)
    public Job getJob() {
        return job;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public void setTargetCount(int targetCount) {
        this.targetCount = targetCount;
    }

    public void setJob(Job job) {
        this.job = job;
    }

    public void setPermissionRole(PermissionRole permissionRole) {
        this.permissionRole = permissionRole;
    }
    //</editor-fold>
}
